from applications.extensions import db


# 情绪课程关键帧
class EvalutionReference(db.Model):
    __tablename__ = 'EVALUTION_REFERENCE'
    evalution_index = db.Column(db.Integer, primary_key=True, comment='情绪课程关键帧主键')
    course_id = db.Column(db.Integer, comment='课程id')
    evaluation_id = db.Column(db.Integer, comment='同一视频内关键帧的排序')
    evalution_period_start_time = db.Column(db.String(255), comment='开始时间')
    evalution_period_end_time = db.Column(db.String(255), comment='开始时间')
    reference = db.Column(db.String(255), comment='情绪')
    tone = db.Column(db.String(255), comment='语气')


# 心理课程关键帧
class EvalutionReferenceMen(db.Model):
    __tablename__ = 'evalution_reference_men'
    evalution_index = db.Column(db.Integer, primary_key=True, comment='心理课程关键帧主键')
    course_id = db.Column(db.Integer, comment='课程id')
    evaluation_id = db.Column(db.Integer, comment='同一视频内关键帧的排序')
    evalution_period_start_time = db.Column(db.String(255), comment='开始时间')
    evalution_period_end_time = db.Column(db.String(255), comment='开始时间')
    reference = db.Column(db.String(255), comment='语气')


# 动作反应训练关键帧
class PointActionResponse(db.Model):
    __tablename__ = 'point_actionresponse'
    point_id = db.Column(db.Integer, primary_key=True, comment='动作反应训练关键帧主键')
    course_id = db.Column(db.Integer, comment='课程id')
    start_time = db.Column(db.Integer, comment='开始时间')
    end_time = db.Column(db.Integer, comment='结束时间')
    action_id = db.Column(db.Integer, comment='动作id')
    scene_des = db.Column(db.String(255), comment='关键帧描述')
    action_name_dict = action_class = {'勾拳': 0, '格挡': 1, '肘击': 2, '直拳': 3, '踢腿': 4, '提膝': 5, '戒备': 6,
                                       '闪躲': 7, '无动作': -1}
    action_id_dict = ['勾拳', '格挡', '肘击', '直拳', '踢腿', '提膝', '戒备', '闪躲']


# 动作标准训练关键帧
class KeyframeInfo(db.Model):
    __tablename__ = 'keyframe_info'
    keyframe_id = db.Column(db.Integer, primary_key=True, comment='动作标准训练关键帧主键')
    action_id = db.Column(db.Integer, comment='动作id')
    keyframe_time = db.Column(db.Integer, comment='关键帧时间位置(ms)')
    keyframe_description = db.Column(db.String(255), comment='开始时间')
    keyframe_focus = db.Column(db.Integer,
                               comment='关键帧关注关节点(数值后十位表示是否关注某个关节,1左肩 2左肘 3左腕 4左脚 5左膝 6右肩 7右肘 8右腕 9右脚 10右膝')
    keyframe_skeleton = db.Column(db.LargeBinary, comment='关键帧对应的人体骨架')
